import service from "@/utils/request"

import LoginWork from "@/utils/LoginWork"

// 待出库明细新增
export const DetailsToBeReleasedAdded = (mtlNo: string) => {
    return LoginWork.post<any, any>(`/pcFactorStockQuery/csmOutTempAdd?mtlNo=${mtlNo}`)
}
export const JianDetailsToBeReleasedAdded = (mtlNo: string) => {
    return LoginWork.post<any, any>(`/product/sdmaterial/outMaterialInTemp?mtlNo=${mtlNo}`)
}
// 待出明细查询
export const DetailsToBeQueried = () => {
    return service.get<any, any>(`/pcFactorStockQuery/getCsmOutTempQuery`)
}
export const JianDetailsToBeQueried = () => {
    return service.get<any, any>(`/product/sdmaterial/pcSlipTempPartOutList`) as any
}
// 出库原因
export const OutBank = () => {
    return service.get<any, any>(`/back/outSlipReasonQuery`)
}

// 其他材料出库明细材料

export interface QueryDetailsOfOtherMaterialDeliveryParms {
    lotNo: string,
    mtlName: string,
    sendNo: string,
    slipDateEnd: string,
    slipDateStart: string,
    slipNo: string,
    slipReason: string,
    sysDateEnd: string,
    sysDateStart: string,
    vendorNo: string
}

export const QueryDetailsOfOtherMaterialDelivery = (parms: QueryDetailsOfOtherMaterialDeliveryParms) => {
    return service.put<any, any>('/pcFactorStockQuery/getCsmOutDetQuery', parms)
}
export const JianQueryDetailsOfOtherMaterialDelivery = (parms: QueryDetailsOfOtherMaterialDeliveryParms) => {
    return service.post<any, any>('/product/sdmaterial/pcSlipDetailOutList', parms)
}
// 待出耗品删除
export const ConsumablesToBeRemoved = (mtlNo: string) => {
    return LoginWork.post<any, any>(`/pcFactorStockQuery/csmOutTempDelete?mtlNo=${mtlNo}`)
}
export const JianConsumablesToBeRemoved = (mtlNo: string) => {
    return LoginWork.post<any, any>(`/product/sdmaterial/deletePcSlipTemp?mtlNo=${mtlNo}`)
}
// 出库批处理
export interface BatchProcessingOutOfStorageParms {
    deptName: string,
    deptNo: string,
    mtlNo: string,
    sendNo: string,
    slipDate: string,
    slipReason: string,
    sysDate: string,
    vendorName: string,
    vendorNo: string
}

export const BatchProcessingOutOfStorage = (parms: BatchProcessingOutOfStorageParms) => {
    return LoginWork.put<any, any>('/pcFactorStockQuery/csmOutDetAdd', parms)
}
export const JianBatchProcessingOutOfStorage = (parms: any) => {
    return LoginWork.post<any, any>('/product/sdmaterial/outBatchInPcSlipTemp', parms)
}
// 其他材料出库明细删除
export const OtherMaterialDeliveryDetailsAreDeleted = (mtlNo: string, slipNo: string) => {
    return LoginWork.post<any, any>(`/pcFactorStockQuery/csmOutDetailDelete?mtlNo=${mtlNo}&slipNo=${slipNo}`)
}